<!DOCTYPE html>
<html lang="zh-cn">
    <head>
        <meta charset="utf-8" />
        <title>Link - ESUI Demo</title>
        <meta http-equiv="X-UA-Compatible" content="IE=Edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link rel="stylesheet" href="assets/google-code-prettify/prettify.css" />
        <link rel="stylesheet" href="assets/themes/standard.css" />
        <!--[if lt IE 9]>
        <link rel="stylesheet" href="assets/ie8.css" />
        <![endif]-->
    </head>
    <body>
        <div class="header">
            <h1 id="branding">ESUI - Link</h1>
        </div>
        <div class="ui-g main-container">
            <div id="side-bar" class="ui-u-1-5">
                <ul id="navigator" class="ui-nav">
                </ul>
            </div>
            <div id="main" class="ui-u-4-5">
                <h2>Link</h2>
                <div class="intro">
                    <p>基本Link。</p>
                </div>
                <div class="example ui-demo-light-stage">
                    <a data-ui-type="Link" href="http://www.baidu.com" target="_blank">www.baidu.com</a>
                    <br />
                    <a data-ui-type="Link" data-ui-href="http://www.baidu.com" data-ui-target="_blank">www.baidu.com</a>
                    <br />
                    <br />
                    <button type="button" class="ui-button" id="op-get-href">get href</button>
                    <button type="button" class="ui-button" id="op-get-content">get content</button>
                    <button type="button" class="ui-button" id="op-get-target">get target</button>
                    <br />
                    <br />
                    <button type="button" class="ui-button" id="op-set-href">set href</button>
                    <button type="button" class="ui-button" id="op-set-target">set target(_self)</button>
                    <button type="button" class="ui-button" id="op-set-content">set content</button>
                    <br />
                    <br />
                    设置content为Label ui(&lt;span data-ui-type=&quot;Label&quot; data-ui-text=&quot;www.google.com&quot;&gt;&lt;/span&gt; ):
                    <br />
                    <br />
                    <button type="button" class="ui-button" id="op-set-ui-content">set ui content</button>
                    <br />
                    <br />
                    <span data-ui-type="Link" data-ui-href="http://www.baidu.com" data-ui-target="_blank">tagName not A</span>
                </div>
            </div>
        </div>

        <script src="assets/loader/esl.js"></script>
        <script src="config.js"></script>
        <script src="demo.js"></script>
        <script src="assets/google-code-prettify/prettify.js"></script>
        <script id="main-js">
        require(
            [
                'esui',
                'esui/Label',
                'esui/Link',
                'esui/Tab',
                'demo'
            ],
            function (ui) {
                var link = ui.init()[1];
                link.onclick = function () {
                    alert('dont click me ok?');
                };
                document.getElementById('op-get-href').onclick = function () {
                    alert(link.get('href'));
                };
                document.getElementById('op-get-target').onclick = function () {
                    alert(link.get('target'));
                };
                document.getElementById('op-get-content').onclick = function () {
                    alert(link.get('content'));
                };
                document.getElementById('op-set-href').onclick = function () {
                    link.set('href', 'https://github.com');
                };
                document.getElementById('op-set-target').onclick = function () {
                    link.set('target', '_self');
                };
                document.getElementById('op-set-content').onclick = function () {
                    link.set('content', '<i>∏∏∏∏∏∏∏∏∏balabala</i>');
                };
                document.getElementById('op-set-ui-content').onclick = function () {
                    link.set('content', '<span data-ui-type="Label" data-ui-text="www.google.com"></span>');
                };
            }
        );
        </script>
        <script src="sitemap.js"></script>
    </body>
</html>
